# -*- coding:utf-8 -*-
from mod.server import extraServerApi
class PluginManager:
    # type: () -> None
    """
    插件管理类，请在插件的__init__中调用 apiUtil.getPluginManager().registerPlugin(self) 将插件注册
    """

    def listenEvent(self, params):
        # type: () -> None
        """
        用于 @Listener 装饰器的监听函数
        """
        pass

    def registerPlugin(self, clazz):
        # type: () -> None
        """
        请在插件的__init__中时调用 apiUtil.getPluginManager().registerPlugin(self) 将插件注册
        """
        pass

    def getServerType(self):
        # type: () -> str
        """
        Returns:
            serverType (str): 当前服务器的类型
        """
        return ""


    def getServerFolder(self):
        # type: () -> str
        """
        Returns:
            path (str): 当前服务器的根目录
        """
        return ""


    def getServerId(self):
        # type: () -> str
        """
        Returns:
            serverId (str): 当前服务器的ID
        """
        return ""


    def isFormalServer(self):
        # type: () -> bool
        """
        Returns:
            isFormalServer (bool): 当前是否在正式服环境
        """
        return False


    def registerCommand(self, command, commandExecuter):
        # type: (str, CommandExecuter) -> None
        """
        注册指令
        Args:
            command (str): 指令头。
            commandExecuter (CommandExecuter): 指令处理器。
        """
        pass

class CommandExecuter:
    # type: () -> None
    """
    示例用法：

    class HealCommand(CommandExecuter):
        def __init__(self):
            CommandExecuter.__init__(self)
            self._actions = {
                "self": self.healSelf,
                "other": self.healOther
            }

        def healSelf(self, sender, args):
            sender.setHealth(sender.getMaxHealth())
            sender.sendMessage("您已恢复到最大生命")

        def healOther(self, sender, args):
            fighter = fighters.getFighterById(args[0])
            fighter.setHealth(fighter.getMaxHealth())
            sender.sendMessage("已将%s恢复到最大生命" % (fighter.getName()))

        def help(self, sender):
            sender.sendMessage(".heal self: 治疗自己")
            sender.sendMessage(".heal other 实体ID: 治疗其他实体")

    apiUtil.registerCommand("heal", HealCommand())

    # 玩家执行指令：
    # .heal self：调用healSelf，sender=发送者，args=[]
    # .heal other 123456：调用healOther，sender=发送者，args=["123456"]
    """

    def __init__(self):
        # type: () -> None
        """
        初始化指令
        """
        pass

    def help(self, fighter):
        """
        请重写此函数，并实现指令的帮助信息
        """
        pass

